#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <unordered_map>

using namespace std;

// https://leetcode.cn/problems/group-anagrams/?envType=study-plan-v2&envId=top-100-liked

class Solution
{
public:
    vector<vector<string>> groupAnagrams(vector<string> &strs)
    {
        vector<vector<string>> ans;
        unordered_map<string, vector<string>> curStr;
        for (auto &s : strs)
        {
            string key = s;
            sort(key.begin(), key.end());
            curStr[key].push_back(s);
        }
        for(auto & strSet : curStr){
            ans.push_back(move(strSet.second));
        }
        return ans;
    }
};

int main()
{
    return 0;
}